// 书写品牌管理模块接口
import request from '@/utils/request'
import type { TradeMark, TradeMarkResponseData } from './type'
// 品牌管理模块接口地址
enum API  {
  // 品牌列表
  brandList= '/admin/product/baseTrademark/',
  // 添加品牌
  addBrand=  '/admin/product/baseTrademark/save',
  // 修改品牌
  updateBrand= '/admin/product/baseTrademark/update',
  // 删除品牌
  deleteBrand= '/admin/product/baseTrademark/remove/',
}

// 列表
export const reqBrandList = (page:number,limit:number) => request.get<any,TradeMarkResponseData>(API.brandList+`${page}/${limit}`)

// 添加或修改品牌
export const reqAddOrUpdateBrand = (tradeMark:TradeMark) => {
  if(tradeMark.id){
    return request.put<any,any>(API.updateBrand,tradeMark)
  }else{
    return request.post<any,any>(API.addBrand,tradeMark)
  }
}

// 删除
export const reqDeleteBrand = (id:number) => request.delete<any,any>(API.deleteBrand+id)